<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/23
 * Time: 10:23
 */

namespace app\admin\model;


use think\Model;
use think\Db;
use think\Session;

class login extends Model
{
    public function login($a,$p){
        $admin=Db::name("admins")->where('adminname',$a)->find();
        if(!$admin){
            return 2;
            //echo "<script>alert('账号不存在！');</script>";
        }else if(md5($p)!=$admin['password']){
            return 1;
            //echo "<script>alert('密码错误！');</script>";
        }else{
            Session::set('login_admin',$a);
            Session::set('login_id',$admin['adminid']);
            //$this->redirect('video/index');
            return 3;
        }

    }
}